/**
 * goio-bean
 * 
 * This class is The main class for the project Bean
 * 
 * @link http://www.marcosperon.com/
 * @copyright 2009 - Peron Co.
 * @author Marcos Peron
 * @package com.marcosperon.bean
 * @version 2009
 */
package com.mperon.bean;

import com.mperon.bean.hb.HibernateUtil;
import org.hibernate.Session;
import org.hibernate.Transaction;

//
/**
 * The Class App.
 */
public class App {
    /**
     * The main method.
     * 
     * @param args
     *            the arguments
     */
    public static void main(final String[] args) {
        Session session = HibernateUtil.openSession();
        Transaction tx = session.beginTransaction();
        //create objects
        Person p = new Person();
        p.setFirstName("Marcos");
        p.setLastName("Peron");
        p.setActive(true);
        p.setPersonId("04179683962");
        
        session.save(p);
        
        Car c = new Car();
        c.setLicenseNumber("MAL2069");
        c.setModel("GM/Montana");
        session.save(c);
        tx.commit();
        session.close();
        
        session = HibernateUtil.openSession();
        tx = session.beginTransaction();
        //create objects
        Person p2 = (Person)session.load(Person.class, new Long(1));
        p2.setLastName("Da Silva 333");
        session.save(p2);
        tx.commit();
        session.close();
                
        
        
        
    }
}
